<?php

require_once 'core/vn.template.php';

class lateralplains extends VNTemplate{

	private $vn;

	/**
	 * Details about the author of the template.
	 */
	private $name		= 'lateralplains';
	private $creationDate	= '17th Feb 2012';
	private $author		= 'James Weir';
	private $authorEmail	= 'weiry@weirynet.com';
	private $authorURL	= 'http://weirynet.com';
	private $version	= '1.0';
	private $description	= 'First template design!';

	/**
	 * Should possibly contain "folder" type and include whole folders
	 * However you can't specifically ORDER the includes.
	 * 
	 * TODO: 
	 * 	Implement folder includes
	 * 	If "css", error on "folder" => "css" and vice versa
	 */
	private $headers = array(	//"css"  => array( "template.css", "style.css" ),
					//"js"   => array( "jquery.min.js" ),
					"fold" => array( "css", "js" ),
					"meta" => array( 
							array("author", "James Weir" ), // problems occur when using $vars
							array("description", "First template design!") //problems occur when using $vars
							), 
					
				);

	private $mainMenu = array(	"home" 		=> array("text" => "Home", 	"permission" => 1),
					"product" 	=> array("text" => "Product", 	"permission" => 1),
					"tech" 		=> array("text" => "Tech", 	"permission" => 1),
					"cloud" 	=> array("text" => "Cloud", 	"permission" => 1),
					"logout"	=> array("text" => "Logout",	"permission" => 2));

	public function __toString(){

		return "Template: ".$this->name." by ".$this->author." built on ".$this->creationDate;

	}

	public function __Construct(VNBase $_vn){

		$this->vn = $_vn;

	}

	public function loadTemplate(){

		/**
		 * This section of code needs vast improvements
		 * so that new objects arent required for building.
		 */
		$session = new VNSession();
		$vn = $this->vn; //causes infinite loop if told to include template

		//parse the page request and other GET variables
		$parsed = explode('&' , $_SERVER['QUERY_STRING']);
		$page = & string(array_shift($parsed));

		$headers = $this->loadHeaders(); //css,js
		$mainMenu = $this->mainMenu;

		include_once $this->name.'/index.php';

	}

	
	public function getContent(string &$_page, array &$_vars){

		$vars = $_vars;
		$headers = $this->loadHeaders();
		include_once $_page;

	}

	public function loadHeaders(){

		return $this->loadFile(
				$this->headers,
				array( "template" => $this->name ));

	}

};
